<template>
	<view class="content">
		<image class="logo" src="/static/logo.png" @click="reflushPage()"></image>
		<view class="text-area" @click="gonext()">
			<text class="title">{{title}}</text>
			<text>{{nums}}</text>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				nums: 1,
				title: 'home主页'
			}
		},
		onLoad() {
		},
		onShow() {
			console.log(uni.$router.params);
		},
		methods: {
			publicTest(...arg) {
				console.log('我是honme页');
				console.log(arg);
			},
			reflushPage() {
				uni.$router.reloadPage()
			},
			doFun() {
				this.nums++
			},
			gonext() {
				// 需要传递参数
				uni.$router.to({
					url: 'pages/demo/index?hh=我是url上的参数',
					query: {
						a: '我是query传参方式，刷新页面数据不会消失'
					},
					params: {
						p: '我是params，刷新页面会消失，可用于app，小程序,并且支持任意跳转方式传参',
						testFun: this.doFun
					},
					event(a, p, q) {
						console.log(a, p, q)
						console.log('触发啦-11111111---', 6666666)
					}
				})
				// 只跳转
				// uni.$router.to('pages/demo/index')
			}
		}
	}
</script>

<style>
	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}

	.logo {
		height: 200rpx;
		width: 200rpx;
		margin-top: 200rpx;
		margin-left: auto;
		margin-right: auto;
		margin-bottom: 50rpx;
	}

	.text-area {
		display: flex;
		justify-content: center;
	}

	.title {
		font-size: 36rpx;
		color: #8f8f94;
	}
</style>